
function requestAndRenderMarquee() {
    window.raceList = [];

    var url = window.svrHosts.walletHost() + 'race/invite/?dowant=' + window.pageMode;
    do_wallet_post(url, {}, {
        always: function() {
        },
        succ: function(res) {
            if (res.Body && res.Body.list) {
                $api.removeCls($api.byId('invite-marquee'), 'aui-hide');
                var html = doT_Render('#tpl-marquee', res.Body.list);
            	$api.append($api.byId('invite-marquee-container'), html);
                window.raceList = res.Body.list;
                startMarquee();
            }
        },
        error: function(err, url) {
            utils.postErrNoTips(err, url);
        }
    });
}

// 启动跑马灯
var marqueeTimer = null;
var marqueeBegin = 0;
function startMarquee() {
	if (window.raceList.length > 1) {
		marqueeBegin = 0;
		marqueeTimer = setInterval(function () {
			marqueeBegin = marqueeBegin + 1;
			if (marqueeBegin >= window.raceList.length) {
				marqueeBegin = 0;
			}

			$("#invite-marquee-container .invite-marquee-text:first-child").animate({
				marginTop: '-' + (marqueeBegin * 1.7) + 'rem'
			}, 500, 'ease-out');

		}, 5000);

	} else {
		clearInterval(marqueeTimer);
		marqueeTimer = null;
	}
}
